Accessing or modifying data outside of an allocated address space is a well-known problem in programming languages. An unintended memory reference can cause faults, data corruption or breaches in the security of an entire system, potentially causing substantial damage to the system and the underlying data. Memory references that occur outside of an allocated memory space may render software unreliable, and these errors may be difficult to detect in many cases.
Programming languages such as Java, for example, implement secure memory access methodologies in programming semantics. In Java, every memory access is guaranteed to be safe and within the range of addresses as intended by the programmer. However, Java does not support the use of pointers to objects; therefore it is much easier to enforce data access security in Java when compared to languages such as C/C++, for example, that do support the use of pointers. In C/C++, knowledge regarding bounds to which a pointer to an object can point is lost, and it is almost impossible to identify and test for potential illegal memory accesses at run time when the data is accessed.
Conventionally, memory accesses bound checking is usually performed in software. A compiler generates bound checking code and memory address checking is performed at runtime. An error is issued if an out of bound memory addresses is detected. However, this process substantially degrades performance of the code being executed because a substantial amount of checking is involved. Special compiler optimizations have been developed to move bound checks out of loops, for example, to code segments that are less frequently executed.
Some specialized hardware, such as employed by certain types of Intel processors, for example, support software bound checking libraries (e.g. Intel Parallel Studio XE 2013) to improve the performance of bound checking operations. Generally, a compiler generates code and prepares bound checking data for the new hardware memory instructions. These machines execute bound checking code in parallel with the execution of the rest of the code using different cores. However, pointers are excluded in these systems, as mentioned above. Better bound checking is needed.